home *** CD-ROM | disk | FTP | other *** search
- #!/bin/bash -e
-
- pkg=vim-tiny
- variant=tiny
-
- # two things to do:
- # 1) remove /usr/bin/vim.variant as alternative for /usr/bin/vim
- # 2) remove /usr/bin/gvim as an alternative for gnome-text-editor for
- # variants built with gnome support
-
- # check_and_remove_alternative cleans up stale alternatives that were left
- # behind from previous mishandling of alternatives.
- check_and_remove_alternative () {
- if update-alternatives --list $1 | grep -q bin/vim; then
- for f in `update-alternatives --list $1 | grep 'bin/vim$'`; do
- update-alternatives --remove $1 $f
- done
- fi
- }
-
- remove_gnome_alternative () {
- if [ -f /usr/bin/vim.$variant ]; then
- check_and_remove_alternative gnome-text-editor
- update-alternatives --remove gnome-text-editor /usr/bin/vim.$variant
- fi
- }
-
- remove_variant_alternative () {
- for i in vi view ex editor rvim rview vimdiff vim; do
- check_and_remove_alternative $i
- update-alternatives --remove $i /usr/bin/vim.$variant
- done
- case "$variant" in
- gtk|lesstif|perl|python|ruby|tcl|gnome|full) # gui enabled variants
- remove_gui_variant_alternative
- ;;
- esac
- }
-
- remove_gui_variant_alternative () {
- for i in eview evim gview gvimdiff rgview rgvim gvim; do
- check_and_remove_alternative $i
- update-alternatives --remove $i /usr/bin/vim.$variant
- done
- }
-
- case "$1" in
- remove)
- case "$pkg" in
- vim-gnome|vim-full) # gnome enabled variants
- remove_gnome_alternative
- ;;
- esac
- remove_variant_alternative
- ;;
- esac
-
-
-
- exit 0
-